import React, { Component, useState, useEffect } from 'react';

export default function useIntervalJob(fnc, time, test) {
  let timer;
  useEffect(() => {
    clearTimeout(timer);
    timer = setTimeout(() => {
      fnc();
    }, time);
  }, [test]);
  useEffect(() => {
    return () => {
      clearTimeout(timer);
    };
  }, []);
}
